-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(idempotency): manipulate idempotent response via response hook #3071
feat(idempotency): manipulate idempotent response via response hook #3071
Conversation
I don't know why but when i ran
I had to revert to |
Thank you for reporting this! I've tried to take a quick look and I can't seem to figure out why this is happening, the error message is also quite unhelpful. The only thing I was able to figure out is that this seem to happen only when using the docker image. If I run the docs using Python locally (commands below) it builds and works normally, so I am not sure. Create a virtual environment & enable it (optional but recommended): python3 -m venv .venv
source .venv/bin/activate Then install the dependencies & start the local server: pip install --require-hashes -r docs/requirements.txt
mkdocs serve --dev-addr=0.0.0.0:8080
This seems the easiest way to unblock you, unless you already have Python 3.x on your machine and want to run the commands above. For now I won't revert the commit since this seems to affect only the dev environment, but not the regular deployments. I'll however continue to look into it. I have opened an issue to track this #3073. We'll try to review the PR between later today & tomorrow morning. For the better part of today we'll focus on releasing v2.8.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great quality PR, @arnabrahman! No notes 💯
Thank you also for the patience in me reviewing it, appreciate your contributions always!
Mid next week at the latest I'll work on adding more issues for potential contributions, stay tuned in case you're interested :) In the meantime, there's also this one that might interest you.
Quality Gate passedIssues Measures |
Actually, i have faced the issue at my work. Made a comment there |
Summary
According to the issue description, when idempotency is triggered we should be able to call a function. This function will allow users to modify the response if necessary. This PR adds this functionality via a response hook.
Changes
responseHook
in theIdempotencyConfig
class.determineResultFromIdempotencyRecord
function to benon-static
, allowing it to access the configuration.determineResultFromIdempotencyRecord
function, check for the presence ofresponseHook
during an idempotent request, and trigger it if it exists.responseHook
in the unit tests for thedetermineResultFromIdempotencyRecord
function.responseHook
following the Python Powertools documentation as a reference.Issue number: #2887
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.